import {httpRequest} from '@/utils/http';
import { AnnualInspectionVO, AnnualInspectionForm, AnnualInspectionQuery } from '@/api/iot/annualInspection/types';

enum Api {
    root = '/iot/annualInspection',
    list = '/iot/annualInspection/list',
    start = '/iot/annualInspection/start',
    confirmAnnualInspection = '/iot/annualInspection/confirmAnnualInspection',
}
/**
 * 查询电梯年检管理列表
 * @param query
 * @returns {*}
 */
export function listAnnualInspection(query?: AnnualInspectionQuery) {
    return httpRequest.get<AnnualInspectionVO[]>({url: Api.list, data: query});
}

/**
 * 查询电梯年检管理详细
 * @param inspectionId
 */
export function getAnnualInspection(inspectionId: string | number) {
    return httpRequest.get<AnnualInspectionVO>({url: Api.root + '/' + inspectionId});
}

/**
 * 新增电梯年检管理
 * @param data
 */
export function addAnnualInspection(data: AnnualInspectionForm) {
    return httpRequest.post<void>({url: Api.root, data});
}

/**
 * 启动年检
 */
export function startAnnualInspection(inspectionId: string | number) {
    return httpRequest.put<void>({url: Api.start + '/' + inspectionId});
}

/**
 * 确认年检
 */
export function confirmAnnualInspection(data: AnnualInspectionForm) {
    return httpRequest.put<void>({url: Api.confirmAnnualInspection , data});
}